package com.cstz.ydshop.common.utils;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;

public class SQLUtil {

	public static int PAGE_SIZE_WEB = 12;
	
	public static Map<String,Object> getParaMap(){
		Map<String,Object> map = new HashMap<String,Object>();

		return map;
	}

	public static String format(String s){
		if(StringUtils.isNotBlank(s)){
			s = s.trim();
		}

		return s;
	}

	public static String formatLike(String s){
		if(StringUtils.isNotBlank(s)){
			s = s.trim();
		}

		return s;
	}

	public static int getStartRow(int page,int pageSize){
		int startRow = (page -1) * pageSize;

		return startRow;
	}
	
	public static int getTotalPage(int total,int pageSize){
		int page = 0;

		int mod = total % pageSize;
		if(mod==0){
			page = total / pageSize;
		}else{
			page = total / pageSize;
			page = page + 1;
		}
		return page;
	}
}
